#include<iostream>
#include<unistd.h>
#include <signal.h>

using namespace std;


void handler(int signo)
{
    cout<<"process get a signal:"<<signo<<endl;
}


int main()
{
    signal(2,handler);
    
    while(true)
    {
        cout<<"i am a process: "<<getpid()<<endl;
        sleep(1);
    }

    return 0;
}
